package com.project.springboot.dozer;

import org.dozer.spring.DozerBeanMapperFactoryBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;

/**
 * description: Dozer配置类
 * @author 朱正磊
 * @date 2019-10-29 17:42:31
 */
@Configuration
public class DozerConfig {

    /**
     * description: 定义Mapper的bean
     * @author 朱正磊
     * @date 2019-10-28 14:48:24
     * @param resources dozer配置文件
     * @return 返回Bean对象
     */
    @Bean
    public DozerBeanMapperFactoryBean dozerMapper(@Value("classpath*:dozer/*.xml") Resource[] resources) {
        final DozerBeanMapperFactoryBean dozerBeanMapperFactoryBean = new DozerBeanMapperFactoryBean();
        dozerBeanMapperFactoryBean.setMappingFiles(resources);
        return dozerBeanMapperFactoryBean;
    }

}
